package xyz.zhno.mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import xyz.zhno.mall.common.core.util.BeanUtils;
import xyz.zhno.mall.common.mpg.entity.OmsOrder;
import xyz.zhno.mall.common.mpg.mapper.OmsOrderMapper;
import xyz.zhno.mall.order.model.param.OmsOrderParam;
import xyz.zhno.mall.service.OmsOrderService;


/**
 * <p>
 * 订单表 服务实现类
 * </p>
 *
 * @author liushaoqi
 * @since 2020-12-30
 */
@Service
@AllArgsConstructor
public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> implements OmsOrderService {
    private final OmsOrderMapper omsOrderMapper;


    /**
     * 添加订单
     * @param omsOrderParam 参数列表
     * @return 新增订单的ID
     */
    @Override
    public Long insertOrder(OmsOrderParam omsOrderParam) {
        //拷贝属性
        OmsOrder omsOrder = BeanUtils.copyProperties(omsOrderParam,OmsOrder.class);
        //新增订单
        save(omsOrder);
        //返回订单id
        return omsOrder.getId();
    }

    /**
     * 修改订单信息
     * @param omsOrderParam 参数列表
     * @return 新增订单的ID
     */
    @Override
    public Long updateOrder(OmsOrderParam omsOrderParam) {
        return null;
    }


}
